/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ace.states;

import ace.game.entity.player.Profile;
import java.util.Vector;

/**
 *
 * @author LegACy
 */
public class StateFactory {
	/**
	 * Protected constructor
	 */
	protected StateFactory() {}

	public static GameState createState(int id, Vector parameters) {
		//Default value
		GameState NewState = null;

		//Based on id
		switch(id) {
		case GameState.FRONT:
			//Create front state
			NewState = new StateFront();
			break;

		case GameState.LEVELS:
			//Create level selection state
            //NewState = new StateLevel(((Integer)parameters.elementAt(0)).intValue(), (Profile)parameters.elementAt(0));
            NewState = new StateLevel((Profile)parameters.elementAt(0));
			break;

		case GameState.GAME:
			//Create game state
			NewState = new StateGame(Integer.parseInt(parameters.elementAt(0).toString()), (Profile)parameters.elementAt(1));
			break;

		case GameState.CREDITS:
			//Create GameOver State
			NewState = new StateCredit();
			break;

		case GameState.SPLASH:
			//Create GameOver State
			NewState = new StateSplash();
			break;

		case GameState.HELP:
			//Create help State
			NewState = new StateHelp();
			break;

		case GameState.LOADING:
			//Create loading State
			NewState = new StateLoading(parameters);
			break;

		case GameState.CREATE_PROFILE:
			//Create new profile state
			NewState = new StateCreateProfile(parameters); //Must have a parameter: the profile Index
			break;

		case GameState.PROFILE:
			//Create show profile state
			NewState = new StateProfile();
			break;

		case GameState.MENU:
			//Create menu state
			NewState = new StateMenu(parameters); //Must have a parameter: the player Profile
			break;

		case GameState.GARAGE_MENU:
			//Create garage state
			NewState = new StateGarage(parameters); //Must have a parameter: the player Profile
			break;
		}

		//Return the state
		return NewState;
	}
}
